/*-------------------------------------
		sPlugin
	    By Scooby, 2010
-------------------------------------*/

local PLUGIN = {}

PLUGIN.Name = "Ignite"
PLUGIN.Author = "Scooby"
PLUGIN.Command = "ignite"
PLUGIN.Group = 2
PLUGIN.Category = "Punishment"
PLUGIN.Format = "string"
PLUGIN.Use = "<Player> <1/0>"
PLUGIN.Menu = {
	{
		title = "Choose Player",
		cont = "#players",
		apos = 1
	}
}

local info = {}

function PLUGIN:Main( ply, args )
	
	local pl = spl:FindPly( args[1] )
	local on = tonumber( args[2] ) or 1
	
	if( #pl == 0 ) then
		spl:PrintC( ply, spl.red, spl.fnp )
		return false
	elseif( #pl > 1 ) then
		spl:PrintC( ply, spl.red, spl.fmp )
		return false
	end
	
	if( !info[ pl[1]:SteamID() ] ) then info[ pl[1]:SteamID() ] = false end	
	
	if( on == 1 ) then
		if( info[ pl[1]:SteamID() ] == false ) then
			pl[1]:Ignite( 100000000000000000, 50 )
			info[ pl[1]:SteamID() ] = true
			spl:PrintC( spl.green, pl[1]:Nick(), spl.white, " Was Ignited By ", spl.blue, ply:Nick() )
		else
			spl:PrintC( ply, spl.red, "That Player Is Already On Fire" )
		end
	elseif( on == 0 ) then
		if( info[ pl[1]:SteamID() ] == true ) then
			pl[1]:Extinguish()
			info[ pl[1]:SteamID() ] = false
			spl:PrintC( spl.green, pl[1]:Nick(), spl.white, " Was Extinguished By ", spl.blue, ply:Nick() )
		else
			spl:PrintC( ply, spl.red, "That Player Is Not On Fire" )
		end
	end
	
end

spl:AddPlugin( PLUGIN )